package com.example.dance.service;

import com.example.dance.mapper.VideoMapper;
import com.example.dance.mapper.VideoPointsMapper;
import com.example.dance.pojo.Video;
import com.example.dance.pojo.VideoPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GetDataService {

    @Autowired
    VideoMapper videoMapper;

    @Autowired
    VideoPointsMapper videoPointsMapper;
    public List<Video>getVideosList(int type,int currentLen,int currentKeyset,int num){
        int end=currentLen+num;
        if(type==0){
            return videoMapper.getAllVideosList(currentLen,currentKeyset,end);
        }else if(type==1){
            return videoMapper.getVideosListByType(type, currentLen,currentKeyset,end);
        }
        return null;
    }

    public Video getVideoPlay(int videoId) {
        Video re=videoMapper.getVideoById(videoId);
        System.out.println(re);
        return re;
    }

    public List<VideoPoint> getVideoPoints(int videoId) {
        return videoPointsMapper.getVideoPoints(videoId);
    }
}
